import {
  getCollectList
} from '@/api/home'


const state = {
  collectMenuList: []
}

const mutations = {
  SET_COLLECT_MENU_LIST: (state, collectMenuList) => {
    state.collectMenuList = collectMenuList
  },
}

const actions = {
  getCollectMenuList({
    commit
  }) {
    getCollectList({
      currentPage: 1,
      pageSize: 20,
      sort: "desc",
      sidx: "",
    }).then(res => {
      console.log('res===========>', res)
      commit('SET_COLLECT_MENU_LIST', res.data.list)
      resolve(res.data.list)
    }).catch(error => {
      // reject(error)
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
